import com.sun.javaws.IconUtil;

import java.io.FilterOutputStream;
import java.util.Random;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: AliceMana
 * Date: 2022-07-28
 * Time: 20:55
 */
public class Test {
    public static void main(String[] args) {
        // 获取一个数二进制序列中所有的偶数位和奇数位， 分别输出二进制序列
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        for (int i = 31; i >= 1; i -= 2) {
            System.out.print(((n >> i) & 1)+" ");
        }
        System.out.println();
        for (int i = 32; i >= 0; i -= 2) {
            System.out.print(((n >> i) & 1)+" ");
        }
    }

    public static void main11(String[] args) {
        // 编写代码模拟三次密码输入的场景。 最多能输入三次密码，密码正确，提示“登录成功”,
        // 密码错误， 可以重新输 入，最多输入三次。三次均错，则提示退出程序
        Scanner in = new Scanner(System.in);
        String passWord = "123456";
        String input;
        for (int i = 0; i < 3; i++) {
            input = in.next();
            if (input.equals(passWord)) {
                System.out.println("密码正确");
                break;
            } else {
                System.out.println("密码错误，你还有"+(2-i)+"次机会");
            }
            if (i == 2) {
                System.out.println("退出程序！");
            }
        }
    }
    public static void main10(String[] args) {
        //输出一个整数的每一位，如：123的每一位是3，2，1
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        while (n != 0) {
            System.out.println(n%10);
            n /= 10;
        }
    }
    public static void main9(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= i; j++) {
                System.out.print(j+"x"+i+"="+ i*j+"\t");
            }
            System.out.println();
        }
    }
    public static void main8(String[] args) {
        // https://www.nowcoder.com/practice/83d6afe3018e44539c51265165806ee4
        Scanner in = new Scanner(System.in);
        while (in.hasNextInt()) {
            int num = in.nextInt();
            for (int i = 0; i < num; i++) {
                for (int j = 0; j < num; j++) {
                    if (i == j || j + i == num - 1) {
                        System.out.print("*");
                    } else {
                        System.out.print(" ");
                    }
                }
                System.out.println();
            }
        }
    }
    public static void main7(String[] args) {
        // 求出0～n之间的所有“水仙花数”并输出。(“水仙花数”是指一个三位数，
        // 其各位数字的立方和确好等于该数本 身，如；153＝1^3＋5^3＋3^3，则153是一个“水仙花数“。）
        for (int i = 100; i < 1000; i++) {
            int a = i%10;
            int b = i%100/10;
            int c = i/100;
            if (Math.pow(a, 3) + Math.pow(b, 3) + Math.pow(c, 3) == i) {
                System.out.print(i+" ");
            }
        }
    }
    public static void main6(String[] args) {
        // 计算1/1-1/2+1/3-1/4+1/5 …… + 1/99 - 1/100 的值 。
        double sum1 = 0.0;
        double sum2 = 0.0;
        for (int i = 1; i <= 100; i++) {
            if (i%2 != 0) {
                sum1 += 1.0/i;
            } else {
                sum2 += 1.0/i;
            }
        }
        double ret = sum1 - sum2;
        System.out.println(ret);
    }

    public static void main5(String[] args) {
        // 求一个整数，在内存当中存储时，二进制1的个数。
        Scanner in = new Scanner(System.in);
        System.out.println("请输入一个整数：");
        int num = in.nextInt();
        int count = 0;
        while (num != 0) {
            if ((num&1) != 0) {
                count++;
            }
            num >>>= 1;
        }
        System.out.println(count);
    }


    public static void main4(String[] args) {
        // Java实现猜数字游戏
        Random random = new Random();
        Scanner in = new Scanner(System.in);
        int num = random.nextInt(99);
        num++;
        int scan = 0;
        while (true) {
            System.out.print("(1~100)请输入你想要猜的数字:>");
            scan = in.nextInt();
            if (scan == num) {
                System.out.println("恭喜你，猜对了！");
                break;
            } else if (scan > num){
                System.out.println("猜大了");
            } else if (scan < num) {
                System.out.println("猜小了");
            }
        }
    }
    public static void main3(String[] args) {
        // 求n的阶乘和
        // for循环实现
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int sum = 0;
        for (int i = n; i >= 1; i--) {
            int ret = 1;
            for (int j = 1; j <= i; j++) {
                ret *= j;
            }
            sum += ret;
        }
        System.out.println(sum);
    }
    public static void main2(String[] args) {
        // 找到1-100之间，既能被3整除，也能被5整除的数字
        // while循环实现
        int i = 0;
        while (i <= 100) {
            i++;
            if(i%3 != 0 || i%5 != 0) {
                continue;
            }
            System.out.print(i+" ");
        }
    }


    public static void main1(String[] args) {
        // 求n的阶乘和
        Scanner in = new Scanner(System.in);
        System.out.print("请输入n:>");
        int n;
        n = in.nextInt();
        int sum = 0;
        while (n >= 1) {
            int ret = 1;
            int i = n;
            while (i >= 1) {
                ret *= i;
                i--;
            }
            sum += ret;
            n--;
        }
        System.out.println(sum);
    }
}